<template>
  <div class="location-test">
    <h2>客户定位优化功能测试</h2>
    
    <a-card title="测试地址" style="margin-bottom: 16px;">
      <a-input-search
        :value="testAddress"
        @update:value="val => testAddress = val"
        placeholder="输入测试地址"
        @search="handleAddressChange"
        enter-button="测试定位"
        size="large"
      />
    </a-card>

    <a-card title="定位结果">
      <div v-if="currentLocation">
        <p><strong>当前坐标：</strong>{{ currentLocation.lng }}, {{ currentLocation.lat }}</p>
        <p><strong>定位来源：</strong>{{ locationSource }}</p>
        <p><strong>置信度：</strong>{{ confidence }}%</p>
      </div>
      <div v-else>
        <a-empty description="请输入地址进行测试" />
      </div>
    </a-card>
  </div>
</template>

<script lang="ts" setup>
import { ref } from 'vue';

const testAddress = ref('');
const currentLocation = ref(null);
const locationSource = ref('');
const confidence = ref(0);

const handleAddressChange = (address: string) => {
  console.log('Testing address:', address);
  // 这里可以调用定位优化的相关方法
};
</script>

<style scoped>
.location-test {
  padding: 24px;
}
</style> 